#include "../Tools/GLHeaders.hpp" 
#include "DisplayFunc.hpp"

#include <cmath>
#include "../Tools/Chrono.hpp"
#include "../Tools/ReferenceCube.hpp"
#include "../Tools/ReferenceFrame.hpp"
#include "../Robot/Robot.hpp"

void DrawGLScene(void){
  static Robot rob;
 	static Chrono timeRot;
	static bool init = false;

	if(!init){
	  timeRot.Activate();
		init = true;
	}

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();
  glTranslatef(0.0f, 0.0f,-7.0f);
	glRotatef(15.0f, 1.0f, 0.0f, 0.0f);	
	glRotatef(20.0f*timeRot.GetTime(), 0.0f, 1.0f, 0.0f);
	//glScalef(0.2f, 0.2f, 0.2f);
	
	ReferenceFrame.Draw();
	//ReferenceCube.Draw();
  for(int i=-5; i < 5; i++){
		for(int j=-5; j < 5; j++){
			glTranslatef((GLfloat)i, 0.0f, (GLfloat)j);
			rob.Draw();
			glTranslatef((GLfloat)-i, 0.0f, (GLfloat)-j);
		}
	}

	glutSwapBuffers();
}
